Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init category indexer #858

Draft
wants to merge 22 commits into
base: develop
Choose a base branch
from
Draft

Init category indexer #858

wants to merge 22 commits into from

Conversation

supercid
Copy link
Member

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Documentation:

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • I have assigned the correct milestone or created one if non-existent.
  • I have correctly labeled this pull request.
  • I have linked the corresponding issue in this description.
  • I have updated the corresponding Jira ticket.
  • I have requested a review from at least 2 reviewers
  • I have checked the base branch of this pull request
  • I have checked my code for any possible security vulnerabilities

@supercid supercid marked this pull request as draft August 2, 2024 11:30
public function getCategoryCollectionQuery(Store $store, array $categoryIds = [])
{
$categories = $this->categoryCollectionFactory->create()
->distinct(true)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can ignore this CS error, since we don't want duplicate ID's

*
* @param array $ids
*/
public function getByIds(array $ids)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this method if it is not being used

Model/Category/Repository.php Outdated Show resolved Hide resolved
{
$this->parentCategoryIdCache[$category->getId()] = $parentCategoryIds;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Model/Service/Sync/AbstractBulkConsumer.php Show resolved Hide resolved
{
$store = $this->nostoScopeHelper->getStore($storeId);
$categoryCollection = $this->collectionFactory->create()
->addIdsToFilter($categoryIds)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to inherit from Magento\Catalog\Model\ResourceModel\Category and create this method, so we can filter by ID when calling the export controller

Model/Service/Update/CategoryUpdateService.php Outdated Show resolved Hide resolved
/** @var CategoryInterface $category */
foreach ($collection->getItems() as $category) {
try {
$parents = $this->nostoCategoryRepository->resolveParentCategoryIds($category);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if instanceof...

$productCollection = $this->collectionFactory->create()
->addIdsToFilter($productIds)
->addStoreFilter($storeId);
$this->syncService->syncProducts($productCollection, $store);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ugljesaspx
You're sending categories, not products. Please check this properly and which syncService is this, should be a syncService for categories, not products.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants